package com.tbfs.admin.web;

import java.util.List;

import org.apache.log4j.Logger;

import com.opensymphony.xwork2.Action;
import com.tbfs.admin.service.sdk.IUserInfoService;
import com.tbfs.admin.vo.UserRole;
import com.tbfs.common.BaseAction;

public class LoadUserRoleAction extends BaseAction {

	private static final Logger logger = Logger
			.getLogger(LoadUserRoleAction.class);

	// init service
	public IUserInfoService userinfoService;

	// 构造函数
	public LoadUserRoleAction(IUserInfoService userinfoService) {
		this.userinfoService = userinfoService;
	}

	public LoadUserRoleAction() {

	}
	
	private String user_id;

	public String getUser_id() {
		return user_id;
	}

	public void setUser_id(String user_id) {
		this.user_id = user_id;
	}

	private List rows = null;

	private Integer total;

	private UserRole userRole;

	public UserRole getUserRole() {
		return userRole;
	}

	public void setUserRole(UserRole userRole) {
		this.userRole = userRole;
	}

	private String message;

	private String volidateAccessDataAuth;

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
	
	public List getRows() {
		return rows;
	}

	public void setRows(List rows) {
		this.rows = rows;
	}

	public Integer getTotal() {
		return total;
	}

	public void setTotal(Integer total) {
		this.total = total;
	}

	/**
	 * 
	 * 
	 * @return
	 */
	public String execute() {
		try {
			
			//初始化查询对象
			if(userRole==null){
				userRole = new UserRole();
			}
			//分页
			this.processPaginationBean();
			volidateAccessDataAuth = this.volidateAccessDataAuth();
			//所有数据
			if("0".equals(volidateAccessDataAuth)){
			}
			userRole.setUser_id(user_id);
			rows  =  userinfoService.getUserRoleList(userRole);
			//total = userinfoService.getUserInfoTotalRows(userRole);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Action.SUCCESS;
	}
	
	/**
	 * save contractinfo data 
	 * @return
	 *//*s
	public String loadUserRoleInfo() {
		if(logger.isDebugEnabled()){
			logger.debug("+++begin save saveUserRoleInfo +++");
		}
		UserRole userRole = new UserRole();
		userRole.setUser_id(user_id);
		//userRole.setRole_id(role_id);
		try {
			userinfoService.addUserRole(userRole);
			userinfo.setMessage("success");
		} catch (Exception e) {
			userinfo.setMessage("保存失败");
			e.printStackTrace();
		}
		
		return Action.SUCCESS;
	}*/
	
	
}
